package com.commution.hit.Ftd.basic;

import java.io.IOException;

import org.apache.http.HttpEntity;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.jsoup.nodes.Document;
import org.jsoup.parser.Parser;
import org.jsoup.select.Elements;

public class basci {
	public static final String URL="http://movie.douban.com/subject/25908042/";
	
	
	public void basict() throws ClientProtocolException, IOException{
		CloseableHttpClient httpclient = HttpClients.createDefault();  	
		
		
		HttpGet  httpGet = new HttpGet(URL);
		System.out.println(httpGet.getURI());
		
		CloseableHttpResponse response = httpclient.execute(httpGet);
		
		HttpEntity entity = response.getEntity();
		System.out.println("--------------------------------------");  
        // 打印响应状态    
        System.out.println(response.getStatusLine());  
        if (entity != null) {  
            // 打印响应内容长度    
            System.out.println("Response content length: " + entity.getContentLength());  
            // 打印响应内容    
//            System.out.println("Response content: " + EntityUtils.toString(entity));  
        }  
        System.out.println("------------------------------------");  
        
        Parser parser = Parser.htmlParser();
        Document document  =parser.parseInput(EntityUtils.toString(entity), "");
        
        Elements select = document.select("div#interest_sectl");
        Elements select1 = document.select("a:matches(http://movie\\.douban\\.com/subject/\\d+)");
        System.out.println(select1);  
	}
	
	

	public static void main(String[] args) throws ClientProtocolException, IOException{
		
		basci basci =new basci();
		basci.basict();
		
	}
}
